Summary(ru_RU.UTF-8): Приветственный PDF-файл для МОС
Summary:	Welcome pages for MOS
Name:		mos-welcome-pages
Version:	2.0
Release:	8
License:	GPLv3
Group:		System/Configuration/Other
Url:		https://os.mos.ru
Vendor:		MOS
Source1:	main.py
Source2:	mos-welcome-pages.desktop
Source3:	mos-welcome-pages.svg
Source4:	welcome-school
Source5:	welcome

BuildArch:	noarch

%description
Shows welcome PDF-file when system runs the first time.

%description -l ru_RU.UTF-8
Показывает PDF файл при первом старте системы.

#------------------------------------------------------------------

%package school
Conflicts:	%{name}-all
Summary(ru_RU.UTF-8): Приветственный PDF-файл для МОС в школах
Summary:	Welcome pages for MOS (school version)
RemovePathPostfixes: .forschool
Requires:	python3-qtpy
Requires:	python3-qpageview
Requires:	python3-poppler-qt5
Requires:	mos-docdir

%description school
Shows welcome PDF-file when system runs the first time.

%description -l ru_RU.UTF-8 school
Показывает PDF файл при первом старте системы.

%files school
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/__pycache__
%{_datadir}/%{name}/main.py
%{_datadir}/mos-doc/welcome.pdf.forschool
%{_sysconfdir}/skel/.config/autostart/mos-welcome-pages.desktop
%{_bindir}/%{name}.forschool
%{_iconsdir}/hicolor/scalable/apps/mos-welcome-pages.svg

#------------------------------------------------------------------

%package all
Conflicts:	%{name}-school
Summary(ru_RU.UTF-8): Приветственный PDF-файл для МОС (общая версия)
Summary:	Welcome pages for MOS (non-school version)
RemovePathPostfixes: .forall
Requires:	python3-qtpy
Requires:	python3-qpageview
Requires:	python3-poppler-qt5
Requires:	mos-docdir

%description all
Shows welcome PDF-file when system runs the first time,
allows enable sending anonymous statistics.

%description -l ru_RU.UTF-8 all
Показывает PDF файл при первом старте системы,
предоставляет возможность установить пакет отправки анонимной статистики.

%files all
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/__pycache__
%{_datadir}/%{name}/main.py
%{_datadir}/mos-doc/welcome.pdf.forall
%{_sysconfdir}/skel/.config/autostart/mos-welcome-pages.desktop
%{_bindir}/%{name}.forall
%{_iconsdir}/hicolor/scalable/apps/mos-welcome-pages.svg

#------------------------------------------------------------------

%prep
%setup -T -c
cp %sources .

%build

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_datadir}/mos-doc
mkdir -p %{buildroot}%{_sysconfdir}/skel/.config/autostart
mkdir -p %{buildroot}%{_iconsdir}/hicolor/scalable/apps
install -m755 main.py %{buildroot}%{_datadir}/%{name}/main.py
cat > %{buildroot}%{_bindir}/%{name}.forschool << EOF
#!/bin/sh
%{_datadir}/%{name}/main.py %{_datadir}/mos-doc/welcome.pdf
EOF
cat > %{buildroot}%{_bindir}/%{name}.forall << EOF
#!/bin/sh
%{_datadir}/%{name}/main.py --stat %{_datadir}/mos-doc/welcome.pdf
EOF
chmod 755 %{buildroot}%{_bindir}/%{name}*
install -m644 mos-welcome-pages.desktop %{buildroot}%{_sysconfdir}/skel/.config/autostart
install -m644 mos-welcome-pages.svg %{buildroot}%{_iconsdir}/hicolor/scalable/apps
install -m644 welcome %{buildroot}%{_datadir}/mos-doc/welcome.pdf.forall
install -m644 welcome-school %{buildroot}%{_datadir}/mos-doc/welcome.pdf.forschool
